#
# Makefile for building the Panfilov method under CUDA
# 

# Choose your include path  for the "arch" file
HOST = $(shell hostname)
FORGE   =  $(shell expr match `hostname` forge)

ifneq ($(FORGE), 0)
PUB	= /uf/ac/baden/cse260-wi12
include $(PUB)/Arch/arch.cuda.forge
else
PUB     = /class/public/cse260-wi12
include $(PUB)/Arch/arch.cuda.gnu
endif


# Uncommnent these lines to list the assembly code
NVCCFLAGS += --ptxas-options=-v
NVCCFLAGS += --opencc-options -LIST:source=on


# If you want to compile for single precision,
# specify single=1 on the "make" command line


# Keep the ptx code
#ifeq ($(keep), 1)
#	NVCCFLAGS	+= -keep
#endif


# You can set the thread block geometry by seting bx= and by= when
# invoking "make"
DIM_X   = -DBLOCKDIM_X=16
DIM_Y   = -DBLOCKDIM_Y=16


ifdef bx
	DIM_X = -DBLOCKDIM_X=$(bx)
endif
ifdef by
	DIM_Y = -DBLOCKDIM_Y=$(by)
endif

#BLOCKING = $(DIM_X) $(DIM_Y)
#NVCCFLAGS += $(BLOCKING)

# If you want to use the cuda timer
# NVCCFLAGS += -DCUDA_TIMER

APP=sgemm

OBJECTS = main.o sgemm_kernel.o

$(APP): $(OBJECTS)
	$(C++) -fPIC -o $@ $(OBJECTS)  $(LDLIBS)

Build: 
	make sgemm

main.o:		sgemm_kernel.o

clean:
	rm -f *.linkinfo *.o  *.vcproj $(APP)
